package com.cosmosource.core.config;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;


/**
 * @author cosmo
 */
@Configuration
@ConditionalOnClass(JSON.class)
public class FastJsonConfig {

    static {
        JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteMapNullValue.getMask();
        // 返回给前端需要存在数组值为null的情况，不使用全局的配置
        JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.WriteNullStringAsEmpty.getMask();
    }
}
